package main

import "fmt"

func f1(yield func(int, string) bool) {
	for i := 0; i < 10; i++ {
		if !yield(i, fmt.Sprintf("I'm %d ", i)) {
			return
		}
	}
}

func main() {
	// 1. Basic usage, accepts iterator functions:
	// func(func() bool)
	// func(func(K) bool)
	// func(func(K, V) bool)
	fmt.Println("Test basic usage: for k,v := range f")
	for k, v := range f1(func(i int, s string) bool {
		if i > 1 {
			return true
		}
		return false
	}) {
		fmt.Println(k, v)
	}
}
